// Using Adafruit Motor shield library


#include <AFMotor.h>

AF_DCMotor motor1(1);
AF_DCMotor motor2(2);
AF_DCMotor motor3(3);
AF_DCMotor motor4(4);

char inChar;

void setup() {
  Serial.begin(9600);           // set up Serial library at 9600 bps
  Serial.println("Missile launcher ok!");

  // turn on motor
  motor1.setSpeed(200);
 
  motor1.run(RELEASE);
}

void loop() {
  motor1.setSpeed(255); 
  motor3.setSpeed(255); 
  motor4.setSpeed(255); 
  
while (Serial.available()) {
       inChar = (char)Serial.read(); 
      }
  switch(inChar){
  case 'L': motor1.run(FORWARD);  //turn clockwise
  break;
  case 'R': motor1.run(BACKWARD);   // turn anti-clock-o-side
  break;
  
  case 'U': motor4.run(FORWARD); // up
  break;
  case 'D': motor4.run(BACKWARD);  // Down
  break;
  
  case 'F': motor3.run(FORWARD); // Fire thing
  break;
  
  default: 
  motor1.run(RELEASE);  // freeze
  motor3.run(RELEASE);
  motor4.run(RELEASE);

   delay(100); 
  }

}




